package cn.stylefeng.guns.modular.gridsystem.netty.tcp;

import cn.stylefeng.guns.modular.gridsystem.config.TcpServerConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author ssy
 * @date 2022/4/12 9:20
 */
@Component
@Slf4j
public class TcpServerRun implements CommandLineRunner {

    @Resource
    private TcpServerConfig config;

    @Resource
    private TcpServer tcpServer;

    @Override
    public void run(String... args) throws Exception {
        if(config.isEnable()){
            tcpServer.run();
        }
    }

}
